<?php

declare(strict_types=1);

namespace App\Request\Store\Goods;

use App\Request\RequestAbstract;

class EditRequest extends RequestAbstract
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'id' => ['integer'],
            'category_id' => ['required', 'integer'],
            'title' => ['required'], // 标题
            'buy_type' => ['required', 'integer'], // 购买方式
            'picture' => ['required', 'string'], // 封面图
            'banners' => ['array'], // 轮播图
            'weight' => ['numeric'], // 商品净重
            'price' => ['required', 'numeric','gt:0'], // 商品价格
            'original_price' => ['required', 'numeric','gt:0'], // 原价
            'integral' => ['required', 'integer', 'gt:0'], // 积分
            'sort' => ['integer'], // 排序
            'page_id' => ['integer'], // 首页种类ID
            'tag' => ['array'], // 商品标签
        ];
    }
}
